from ronglian_sms_sdk import SmsSDK
import json
from django_redis import get_redis_connection


accId = '8a216da87ba59937017bf7c164be14f9'
accToken = 'a731f85e9a634aba895d4c0c7ddc391f'
appId = '8a216da87ba59937017bf7c165b41500'


def send_message(mobile, code, time):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    mobile = '15890172571'
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return True
    return False


def get_redis():
    conn = get_redis_connection()
    return conn